
package threadlogging.jdk;

import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;

/**
 * 
 *    a handler object for java.util.logging
 *
 */
public class ThreadTraceHandler extends Handler
{

	public ThreadTraceHandler()
	{
		this.setLevel(Level.ALL);
	}
	
	@Override
	public void publish(LogRecord record)
	{
		if (ThreadTrace.isEnabled())
		{
			ThreadTrace.add(record);
		}
	}

	
	@Override
	public void close() throws SecurityException
	{
		// empty method
	}

	@Override
	public void flush()
	{
		// empty method
	}

}
